package routers

import (
	"krm_pro/controllers/auth"
	"krm_pro/server/cluster"
	"krm_pro/server/deployment"
	"krm_pro/server/namespace"
	"krm_pro/server/node"
	"krm_pro/server/pod"
	"krm_pro/server/service"

	"github.com/gin-gonic/gin"
)

func Router() {

	route := gin.Default()
	// route.Use(middlewares.JwtCheck)
	r := route.Group("/api")

	{
		r.POST("/auth/login", auth.Login)
		r.POST("/auth/logout", auth.LogOut)

		r.POST("/cluster", cluster.Add)

		r.GET("/auth/token")

		r.GET("/deployment/get", deployment.DeploymentGet)
		r.GET("/deployment/list", deployment.DeploymentList)
		r.POST("/deployment/create", deployment.DeploymentCreate)
		r.POST("/deployment/update", deployment.DeploymentUpdate)
		r.POST("/deployment/delete", deployment.DeploymentDelete)

		r.GET("/service/get", service.ServiceGet)
		r.POST("/service/list", service.ServiceList)
		r.POST("/service/create", service.ServiceCreate)
		r.POST("/service/update", service.ServiceUpdate)
		r.POST("/service/delete", service.ServiceDelete)

		r.GET("/pod/list", pod.PodList)
		r.POST("/pod/get", pod.PodGet)
		r.POST("/pod/create", pod.PodCreate)
		r.POST("/pod/update", pod.PodUpdate)
		r.POST("/pod/delete", pod.PodDelete)

		r.POST("/namespace/list", namespace.NsList)
		r.POST("/namespace/get", namespace.NsGet)
		r.POST("/namespace/create", namespace.NsCreate)
		r.POST("/namespace/update", namespace.NsUpdate)
		r.POST("/namespace/delete", namespace.NsDelete)

		r.POST("/node/list", node.NodeList)
	}

	route.Run()
}
